<template>
  <div>
    <p>
      ask a question:
      <input v-model="question" type="text" />
    </p>

    <p>{{ answer }}</p>
  </div>
</template>
<script lang="ts">
import { Options, Vue } from "vue-class-component";

@Options({
  watch: {
    question(newQuestion, OldQuestion) {
      if (newQuestion.indexOf("?") > -1) {
        this.getAnswer();
      }
    },
  },
})
export default class WatchVue extends Vue {
  question: string = "";

  answer: string = "";

  getAnswer(): void {
    this.answer = "thking a moment";
  }
}
</script>
<style lang="scss" scoped>
</style>